//
//  NwOrderRequest.m
//  KuWoCan
//
//  Created by hwd on 17/3/22.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "NwOrderRequest.h"

@implementation NwOrderRequest

/*
 user.id	string	是	当前用户ID
 pageNo	string	是	当前页码
 pageSize	string	是	每页多少条
 orderStatus	string	否	订单审批状态
 approvalType	string	否	是否拒绝
 approverUserId	string	否	当前审批人id
 */

- (void)startRequestQueryAllOrdersWithUserId:(NSString *)userId pageNo:(NSString *)pageNo pageSize:(NSString *)pageSize orderStatus:(NSString *)orderStatus approvalType:(NSString *)approvalType approverUserId:(NSString *)approverUserId
{
    _showError = YES;
    _showLoading = YES;
    self.isNotDataStr = YES;
    _path = NWOrderQuery_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"user.id":userId,@"pageNo":pageNo,@"pageSize":pageSize,@"statuslist":orderStatus,@"approvalType":approvalType,@"approverUserId":approverUserId}];
    
    _params = dic;
    [self startPost];
}


/*
 user.id	array	是	当前用户id
 userName	string	是	收货人姓名
 userPhone	string	是	下单人电话
 userAddress	string	是	收货人地址
 totalBox	string	是	订单总箱数
 totalPrice	string	是	订单总价格
 totalWeight	string	是	订单总重量
 orderStatus	string	是	订单审批状态（第一次下单时，传1）
 order_memo	string	是	订单备注
 approval_type	string	是	是否拒绝（第一次下单时，传0）
 kwOrderItemList	string	是	所下订单商品（注意商品信息用单引号）	[{'productAttributeId':'a1','productName':'a1','price':100,'quantity':100,'weight':10},{'productAttributeId':'a2','productName':'a2','price':200,'quantity':200,'weight':20}]
 */

- (void)startRequestCommitOrdersWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOrderCommit_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestUpdateOrdersWithDic:(NSMutableDictionary *)dic
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOrderUpdate_Path;
    _params = dic;
    [self startPost];
}

- (void)startRequestOrdersDetailWithOrderId:(NSString *)orderId
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOrderDetail_Path;
    self.isNotDataStr = YES;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"orderId":orderId}];
    
    _params = dic;
    [self startGet];
}

- (void)startRequestDeleteOrdersWithOrderId:(NSString *)orderId
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOrderDelete_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"orderId":orderId}];
    
    _params = dic;
    [self startGet];
}

- (void)startRequestPassOrdersWithOrderId:(NSString *)orderId userId:(NSString *)userId orderStatus:(NSString *)orderStatus approvalType:(NSString *)approvalType refuseReason:(NSString *)refuseReason paymentProof:(NSString *)paymentProof
{
    _showError = YES;
    _showLoading = YES;
    _path = NWOrderPass_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":orderId,@"user.id":userId,@"orderStatus":orderStatus,@"approvalType":approvalType,@"refuseReason":refuseReason,@"paymentProof":paymentProof}];
    _params = dic;
    [self startPost];
}



@end
